package com.me.learnspring.repository;

import com.me.learnspring.model.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.time.LocalDateTime;
import java.util.List;

public interface OrderRepository extends JpaRepository<Order, Long> {
	List<Order> findByCustomer(String customer);
	
	
	// @Query(value = "SELECT * FROM orders WHERE customer=?1 and create_time BETWEEN ?2 and ?3 ORDER BY id DESC",nativeQuery = true)
	List<Order> findByCustomerAndAndCreateTimeBetween(String username, LocalDateTime startDate, LocalDateTime endDate);
}